package cn.stylefeng.guns.modular.forecastClineInformation.controller;

import cn.stylefeng.guns.modular.forecastClineInformation.entity.QyuanPowerSdClineForecast;
import cn.stylefeng.guns.modular.forecastClineInformation.pojo.request.QyuanPowerSdClineForecastRequest;
import cn.stylefeng.guns.modular.forecastClineInformation.service.QyuanPowerSdClineForecastService;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 电网联络线预测信息表，记录每天96个时间点的电网运行预测数据控制器
 *
 * @author 我是谭先生🐻
 * @date 2025/03/14 16:08
 */
@RestController
@ApiResource(name = "电网联络线预测信息表，记录每天96个时间点的电网运行预测数据")
public class QyuanPowerSdClineForecastController {

    @Resource
    private QyuanPowerSdClineForecastService qyuanPowerSdClineForecastService;

    /**
     * 添加
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 16:08
     */
    @PostResource(name = "添加", path = "/qyuanPowerSdClineForecast/add")
    public ResponseData<QyuanPowerSdClineForecast> add(@RequestBody @Validated(QyuanPowerSdClineForecastRequest.add.class) QyuanPowerSdClineForecastRequest qyuanPowerSdClineForecastRequest) {
        qyuanPowerSdClineForecastService.add(qyuanPowerSdClineForecastRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 删除
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 16:08
     */
    @PostResource(name = "删除", path = "/qyuanPowerSdClineForecast/delete")
    public ResponseData<?> delete(@RequestBody @Validated(QyuanPowerSdClineForecastRequest.delete.class) QyuanPowerSdClineForecastRequest qyuanPowerSdClineForecastRequest) {
        qyuanPowerSdClineForecastService.del(qyuanPowerSdClineForecastRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 16:08
     */
    @PostResource(name = "编辑", path = "/qyuanPowerSdClineForecast/edit")
    public ResponseData<?> edit(@RequestBody @Validated(QyuanPowerSdClineForecastRequest.edit.class) QyuanPowerSdClineForecastRequest qyuanPowerSdClineForecastRequest) {
        qyuanPowerSdClineForecastService.edit(qyuanPowerSdClineForecastRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看详情
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 16:08
     */
    @GetResource(name = "查看详情", path = "/qyuanPowerSdClineForecast/detail")
    public ResponseData<QyuanPowerSdClineForecast> detail(@Validated(QyuanPowerSdClineForecastRequest.detail.class) QyuanPowerSdClineForecastRequest qyuanPowerSdClineForecastRequest) {
        return new SuccessResponseData<>(qyuanPowerSdClineForecastService.detail(qyuanPowerSdClineForecastRequest));
    }

    /**
     * 获取列表
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 16:08
     */
    @GetResource(name = "获取列表", path = "/qyuanPowerSdClineForecast/list")
    public ResponseData<List<QyuanPowerSdClineForecast>> list(QyuanPowerSdClineForecastRequest qyuanPowerSdClineForecastRequest) {
        return new SuccessResponseData<>(qyuanPowerSdClineForecastService.findList(qyuanPowerSdClineForecastRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 16:08
     */
    @GetResource(name = "分页查询", path = "/qyuanPowerSdClineForecast/page")
    public ResponseData<PageResult<QyuanPowerSdClineForecast>> page(QyuanPowerSdClineForecastRequest qyuanPowerSdClineForecastRequest) {
        return new SuccessResponseData<>(qyuanPowerSdClineForecastService.findPage(qyuanPowerSdClineForecastRequest));
    }

}
